from selenium.webdriver.common.by import By

from pom.basePage import BasePage

class UserLogin(BasePage):
    user_input = (By.NAME, 'user')
    pwd_input = (By.NAME,'pwd')
    btn = (By.CLASS_NAME,'btn')

    def __init__(self,driver,hostname):
        super().__init__(driver)
        self.url = f"http://{hostname}/jpress/user/login".format(hostname=hostname)
    def goto_login_page(self):
        self.goto_page(self.url)
    def input_user(self,user):
        self.input_text(self.user_input,user)
    def input_pwd(self,pwd):
        self.input_text(self.pwd_input,pwd)
    def submit(self):
        self.click(self.btn)